package com.qf.cloud.service1.controller;

import com.qf.cloud.service1.feign.TokenClient;
import com.qf.cloud.service1.feign.VoteClient;
import com.qf.cloud2203.domain.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.ws.rs.POST;

@RestController
@RequestMapping("/serviceVote")
public class TestVoteClient {
    @Autowired
    VoteClient voteClient;
    @Autowired
    TokenClient tokenClient;
    @GetMapping("/test1")
    public ResultVo test1() {
        ResultVo gettoken = tokenClient.gettoken("13855557777");
        String token = (String) gettoken.get("data");
        ResultVo vo = voteClient.dovote("13855557777", 1, token);
        return vo;
    }
    @GetMapping("/token")
    public ResultVo token() {
        ResultVo gettoken = tokenClient.gettoken("13855556666");
        return ResultVo.ok(gettoken);
    }

}
